def recMax(int_list):
    if len(int_list)==1:
        return int_list[0]
    else:
        n = len(int_list)//2
        left = int_list[n:]
        right = int_list[:n]
        return max(max(int_list[0], recMax(left)), max(int_list[0], recMax(right))) 
int_list = []
while True:
    int_number = input()
    if int_number == '!':
        break
    elif int_number.isdigit():
        int_list.append(int(int_number))
    else:
        continue
print(recMax(int_list))